#include <stdio.h>
#include <stdlib.h>

int main()
{
	int choice = 1, check = 0;
	float input = 0.0, result = 0.0;


	printf("Enter transformation type\n1\tC -> F\n2\tF -> C\nType: ");


	check = scanf("%d", &choice);


	if ( check != 1 || choice > 2 || choice < 1 )
	{
		printf("Incorrect choice. Goodbye!\n");
		return -1;
	}

	printf("Enter temperature: ");
	check = scanf("%f", &input);
	if ( check != 1 )
	{
		printf("Incorrect temperature. Goodbye!\n");
		return -1;
	}

	switch (choice)
	{
	case 1: result = (input * 9/5) + 32;
		break;
	case 2: result = (input - 32) * 5/9;
		break;
	default:
		;
	}


	printf("Transformation %g %c --> %g %c\n", 
		input, choice == 1 ? 'C':'F', result, choice == 1 ? 'F':'C');

	system("PAUSE");
	return 0;
}